package cn.xshi.sys.service.impl;

import cn.xshi.common.base.BaseService;
import cn.xshi.common.util.ExceptionUtil;
import cn.xshi.sys.dao.SysPlatformFeedbackDao;
import cn.xshi.sys.model.SysPlatformFeedback;
import cn.xshi.sys.service.SysPlatformFeedbackService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Desc 平台反馈意见
 * @Author 邓纯杰
 * @CreateTime 2012-12-12 12:12:12
 */
@Service
public class SysPlatformFeedbackServiceImpl extends BaseService implements SysPlatformFeedbackService {

	@Resource
	private SysPlatformFeedbackDao sysPlatformFeedbackDao;

	/**
	 * 分页
	 * @param condition
	 * @return
	 */
	public List<SysPlatformFeedback> getSysPlatformFeedbackListByCondition(Map<String,Object> condition){
		try{
			return sysPlatformFeedbackDao.getSysPlatformFeedbackListByCondition(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	 * 查询对象
	 * @param xt_platform_feedback_id
	 * @return
	 */
	public SysPlatformFeedback getSysPlatformFeedbackById(String xt_platform_feedback_id){
		try{
			SysPlatformFeedback sysPlatformFeedback = sysPlatformFeedbackDao.getSysPlatformFeedbackById(xt_platform_feedback_id);
			return sysPlatformFeedback;
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	 * 添加
	 * @param sysPlatformFeedback
	 * @return
	 */
	public int addSysPlatformFeedback(SysPlatformFeedback sysPlatformFeedback){
		int i = 0;
		try {
			i = sysPlatformFeedbackDao.addSysPlatformFeedback(sysPlatformFeedback);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 修改
	 * @param sysPlatformFeedback
	 * @return
	 */
	public int updateSysPlatformFeedback(SysPlatformFeedback sysPlatformFeedback){
		int i = 0;
		try {
			i = sysPlatformFeedbackDao.updateSysPlatformFeedback(sysPlatformFeedback);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 修改（根据动态条件）
	 * @param sysPlatformFeedback
	 * @return
	 */
	public int updateSysPlatformFeedbackBySelective(SysPlatformFeedback sysPlatformFeedback){
		int i = 0;
		try {
			i = sysPlatformFeedbackDao.updateSysPlatformFeedbackBySelective(sysPlatformFeedback);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 删除
	 * @param condition
	 * @return
	 */
	public int delSysPlatformFeedback(Map<String,Object> condition){
		int i = 0;
		try {
			i = sysPlatformFeedbackDao.delSysPlatformFeedback(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 批量添加
	 * @param sysPlatformFeedbackList
	 * @return
	 */
	public int addBatchSysPlatformFeedback(List<SysPlatformFeedback> sysPlatformFeedbackList){
		int i = 0;
		try {
			i = sysPlatformFeedbackDao.addBatchSysPlatformFeedback(sysPlatformFeedbackList);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 批量修改
	 * @param sysPlatformFeedbackList
	 * @return
	 */
	public int updateBatchSysPlatformFeedback(List<SysPlatformFeedback> sysPlatformFeedbackList){
		int i = 0;
		try {
			i = sysPlatformFeedbackDao.updateBatchSysPlatformFeedback(sysPlatformFeedbackList);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 *
	 * 批量修改（根据动态条件）
	 * @param sysPlatformFeedbackList
	 * @return
	 */
	public int updateBatchSysPlatformFeedbackBySelective(List<SysPlatformFeedback> sysPlatformFeedbackList){
		int i = 0;
		try {
			i = sysPlatformFeedbackDao.updateBatchSysPlatformFeedbackBySelective(sysPlatformFeedbackList);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 根据外键删除方法
	 * @param platformId
	 * @return
	 */
	public int delSysPlatformFeedbackByForeignKey(String platformId){
		int i = 0;
		try {
			i = sysPlatformFeedbackDao.delSysPlatformFeedbackByForeignKey(platformId);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}
}
